package com.hbzjjzx.athlete.athlete.apiInterface;

import com.hbzjjzx.athlete.athlete.domain.Coach;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @program: springcloudhbats
 * @description
 * @author: 周佳佳
 * @create: 2020-01-21 14:04
 **/
@FeignClient(name="coachService",fallback =CoachErrorBack.class )
public interface CoachService {

    @GetMapping("coach/{id}")
    public Coach findById(@PathVariable("id") Integer id);
}

@Component
class CoachErrorBack implements CoachService{

    @Override
    public Coach findById(Integer id) {
        Coach coach = new Coach();
        coach.setCoachName("feign回调方法,错误信息!");
        return coach;
    }
}